
<template>
	<view class="index">
		<view class="userinfo uni-card">
			<view class="uni-list">
				<view class="uni-list-cell-divider">
					用户：
				</view>
				<view class="uni-list-cell" hover-class="uni-list-cell-hover">
					<view class="uni-list-cell-navigate">
						{{user.username || ''}}
					</view>
				</view>
				<view class="uni-list-cell-divider">
					服务器地址：
				</view>
				<view class="uni-list-cell uni-collapse" hover-class="uni-list-cell-hover">
					<view class="uni-list-cell-navigate uni-navigate-right"  @click="editWebsite()">
						{{website || ''}}
					</view>
				</view>
				<view class="uni-list-cell-divider">
					版本号：
				</view>
				<view class="uni-list-cell uni-list-cell-navigate .left_list" hover-class="uni-list-cell-hover">
					<!-- <view class="uni-list-cell-navigate uni-navigate-right" > -->
						<!-- {{versions}} -->
						<!--  #ifdef  APP-PLUS || MP-WEIXIN -->
						V3.1.0
						<!--  #endif -->
						
						<!--  #ifdef  H5 -->
						网页版内测Web4.5(0000468)
						<!--  #endif -->
				</view>
				<!-- </view> -->
			</view>
		</view>
		
		<view class="logout uni-card" >
			<view class="uni-list">
				<view class="uni-list-cell uni-collapse">
					<!-- <view class="uni-list-cell-navigate" hover-class="uni-list-cell-hover"  @click="logout()">
						退出登录
					</view> -->
					<button  type="warn"  @click="logout()" class="logOut_btn">退出</button>
		
				</view>
			</view>
		</view>
		
	</view>
</template>


<script>
	
	import service from '../../service.js';
	import utils from '../../common/utils.js';
	import net from '../../net.js';
	import uniIcons from "@/components/uni-icons/uni-icons.vue"
    import {
        mapState
    } from 'vuex'

    export default {
		components: {uniIcons},
        computed: mapState(['forcedLogin', 'hasLogin', 'userName']),
		data() {
			return {
				user: {
					id: "", 
					username: '', 
				},
				website: '',
				versions:'5.1.3',
			}
		},
        onLoad() {
			let user = service.getUsers();
			Object.assign(this.user, user);
        },
		onShow() {
			this.website = service.getWebsite();
		},
		methods: {
			editWebsite(){
				uni.navigateTo({
					url: '../setting/setting'
				});
			},
			logout() {
				service.logout();
				uni.reLaunch({
					url: '../login/login'
				})
			}
		}
    }
</script>

<style>
	.index{
		width: 100%;
	}
	.uni-card {
		box-shadow: none;
	}

	.uni-list:after {
		height: 0;
	}

	.uni-list:before {
		height: 0;
	}
	
	.userinfo.uni-card {
		margin: 20upx 0 0 0;
	}
	
	.userinfo.uni-card .uni-list-cell, .logout.uni-card .uni-list-cell {
		min-height: 82upx;
	}
	
	.uni-list-cell:after {
		left: 0;
		height: 0;
	}
	
	.uni-list-cell .uni-list-cell-navigate {
		padding-left: 20upx ;
	}
	.left_list{
		padding-left:20upx !important;
	}
	.logout.uni-card {
		margin: 80upx 0 0 0; 
	}
	
	.edit-info.uni-list-cell:last-child:after {
		height: 1upx;
	}
	.logOut_btn{
		width: 80%;
	}
</style>
